<?php
include("../conn.php");

// 传入首页分类id
$homefenleiId = $_REQUEST[homefenleiId];
// 传入首页分类id end

if ($homefenleiId!='') {
	// 获取商家分类id及个数
	
	$query = mysql_query("select cateids from homefenlei where id=".$homefenleiId);
	$cateids = mysql_fetch_assoc($query);
	$cateids = explode(',', $cateids[cateids]);
	$len = count($cateids);
	// 获取商家分类id及个数 end
	$categroys = array();
    $categroy[cateid] = "0";
    $categroy[name] = "全部";
    $categroy[srcimages] = "";
    $categroy[images] = "";
    $categroy[categroy_type_id] = "";
    $categroy[homefenleiId] = $homefenleiId;
    $categroys[0] = $categroy;
	for ($i=0; $i < $len; $i++) { 
		$query = mysql_query("select * from categroy where cateid=".$cateids[$i]);
		$categroy = mysql_fetch_assoc($query);
		$categroy[homefenleiId] = $homefenleiId;
		$categroys[] = $categroy;
	}
	$arr = array('code' => 200, 'tip' =>'查询商家分类成功', 'categroys' => $categroys);
}else{
	$arr = array('code' => 100, 'tip' =>'参数');
}

echo json_encode($arr);